// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import VueResource from 'vue-resource';
Vue.use(VueResource);
Vue.config.productionTip = false;
import VueLazyLoad from 'vue-lazyload';
Vue.use(VueLazyLoad,{
  loading: 'dist/loading.gif',
});
//滚动懒加载
import infiniteScroll from 'vue-infinite-scroll';
Vue.use(infiniteScroll);
//金额格式化
import { currency } from './util/currency';
Vue.filter('currency',currency);
//时间格式化
import moment from 'moment';
Vue.filter('dateFormat', function (dateStr, pattern) {
  return moment(dateStr).format(pattern);
});
//vuex 状态管理
import Vuex from 'vuex';
Vue.use(Vuex);
let store = new Vuex.Store({
  state : {
    cartCount : 0,
  },
  mutations :{
    updateCartCount(state,cartCount){
      state.cartCount += cartCount;
    },
    iniCartCount(state,cartCount){
      state.cartCount = cartCount;
    },
  },
});

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
   render : h=>h(App),
});
